/*********************************************************************************************************************
 *
 * <code>MIPSVBasicBlockBuilder</code> decodes instructions(MIPS instructions here) of a basic block into a series of <code>
 * VInst</code>, and put them in a <code>VBlock</code> 
 *
 ***********************************************************************************************************************/
#ifndef MIPSVBASICBLOCKBUILDER_H
#define MIPSVBASICBLOCKBUILDER_H

#include "crossbit/VBasicBlockBuilder.h"

namespace crossbit {

#define		REGUSED	0x01
#define		REGDEF	0x02

    class MIPSVBasicBlockBuilder : public VBasicBlockBuilder {
        public:
            MIPSVBasicBlockBuilder();

            ~MIPSVBasicBlockBuilder()
            {
            }

            virtual void getReady(XTMemAddr pc);

            virtual void add(VInst *inst);

            // get the final pointer of a <code>VBlock</code>
            virtual VBlock *wrapUp(XTMemAddr pc);

        private:
            static const XTInt32 MAXREGS = 256;

            //Use a static table for speed
            XTInt32 usedRegTable[MAXREGS];		

            //latest used location of the regs in the vblock
            XTInt32 luIndex[MAXREGS];


    };
}

#endif	//MIPSBASICBLOCKBUILDER_H
